#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "Channel.h"

struct EventLoop;
struct Dispatcher
{
    //init--初始化epoll、poll或者select需要的数据块
    void* (*init)();
    //添加
    int32_t (*add)(struct Channel *channel, struct EventLoop *evLoop);
    //删除
    int32_t (*remove)(struct Channel *channel, struct EventLoop *evLoop);
    //修改
    int32_t (*modify)(struct Channel *channel, struct EventLoop *evLoop);
    //事件检测
    int32_t (*dispatch)(struct EventLoop *evLoop, int32_t timeout);//单位：s
    //清除数据（关闭fd或者释放内存）
    int32_t (*clear)(struct EventLoop *evLoop);
};
